﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using XNA.Common.Objects;

namespace TestGame.Entities
{
	public class Player : Actor
	{
		#region CONSTRUCTION

		public Player (float x, float y, float z, int height)
			: base (x, y, z, height, 0)
		{

		}
		
		#endregion

		#region METHODS (PUBLIC)

		public override void Update (GameTime gameTime)
		{
			var keyboard = Keyboard.GetState ();

			if (keyboard.IsKeyDown (Keys.W) || keyboard.IsKeyDown (Keys.Up))
			{
				Move (1, 0);
			}

			if (keyboard.IsKeyDown (Keys.S) || keyboard.IsKeyDown (Keys.Down))
			{
				Move (-1, 0);
			}

			if (keyboard.IsKeyDown (Keys.A) || keyboard.IsKeyDown (Keys.Left))
			{
				Move (0, -1);
			}

			if (keyboard.IsKeyDown (Keys.D) || keyboard.IsKeyDown (Keys.Right))
			{
				Move (0, 1);
			}

			if (keyboard.IsKeyDown (Keys.Q))
			{
				Rotate (0.05f);
			}

			if (keyboard.IsKeyDown (Keys.E))
			{
				Rotate (-0.05f);
			}

			base.Update (gameTime);
		}

		public override void Draw (GameTime gameTime)
		{
			Console.WriteLine (string.Format ("{0:0}, {1:0}, {2}", Position.X, Position.Z, Rotation.Forward));

			base.Draw (gameTime);
		}
		
		#endregion
	}
}
